/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.spring.modelo.entidad;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author Ricardo
 */
@Embeddable
public class DetallePlanPK implements Serializable {
    @Basic(optional = false)
    @NotNull
    @Column(name = "codPlan")
    private int codPlan;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 6)
    @Column(name = "codCurso")
    private String codCurso;

    public DetallePlanPK() {
    }

    public DetallePlanPK(int codPlan, String codCurso) {
        this.codPlan = codPlan;
        this.codCurso = codCurso;
    }

    public int getCodPlan() {
        return codPlan;
    }

    public void setCodPlan(int codPlan) {
        this.codPlan = codPlan;
    }

    public String getCodCurso() {
        return codCurso;
    }

    public void setCodCurso(String codCurso) {
        this.codCurso = codCurso;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (int) codPlan;
        hash += (codCurso != null ? codCurso.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof DetallePlanPK)) {
            return false;
        }
        DetallePlanPK other = (DetallePlanPK) object;
        if (this.codPlan != other.codPlan) {
            return false;
        }
        if ((this.codCurso == null && other.codCurso != null) || (this.codCurso != null && !this.codCurso.equals(other.codCurso))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.spring.modelo.entidad.DetallePlanPK[ codPlan=" + codPlan + ", codCurso=" + codCurso + " ]";
    }
    
}
